package com.my.demo.dao;


import com.my.demo.domain.selectSummaryVo;

      //  # 通过buffer拼接sql语句就可以了，最后返回
public class UserProvider {


    public String userList(selectSummaryVo summaryData){
        StringBuffer buffer = new StringBuffer();
        buffer.append("select * from user  ");
        if(!summaryData.getAge().equals("1") && !summaryData.getAge().equals("")){
            System.out.println("1");
            buffer.append("age=").append("'"+summaryData.getAge()+"'");
        }
        buffer.append(" order by id desc");
        return buffer.toString();
    }

    public String summaryData(selectSummaryVo summaryData){
        StringBuffer buffer = new StringBuffer();
        buffer.append("select * from test_summary_data where ");
        if(!summaryData.getAge().equals("全选") && !summaryData.getAge().equals("")){
            System.out.println("非全选");
            buffer.append("business=").append("'"+summaryData.getAge()+"'").append(" and ");
        }
        buffer.append("createTime between ").append("'"+summaryData.getStartTime()+"'").append(" and ").append("'"+summaryData.getEndTime()+"'").append(" order by id desc");
        return buffer.toString();
    }
}
